using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using SiteECSWeb;

public partial class Employees_AddEmployee : PageBase
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            #region SiteMap
            this.SiteMapNodeProvider = SiteMapProviderNames.ListMXmlSiteMapProvider.ToString();
            SiteMapPath1.SiteMapProvider = SiteMapNodeProvider;
            #endregion
        }
    }
    protected void CreateUserWizard1_CreatedUser(object sender, EventArgs e)
    {
        //int companyID = CompanyProfileBasicInfo1.SaveCompanyProfile();
        EmployeeProfile1.SaveEmpProfile();
    }
    protected void CreateUserWizard1_CreatingUser(object sender, LoginCancelEventArgs e)
    {
        //if (TypeReg == "NewCompanyAccount")
        //{
        //    RoleBiz.Insert("NewUsers");
        //    Roles.AddUserToRole(CreateUserWizard1.UserName, "NewUsers");
        //}
        if (!Roles.RoleExists(RolesName.NewEcs.ToString()))
        {
            RoleBiz.Insert(RolesName.NewEcs.ToString());
        }

        if (!Roles.IsUserInRole(CreateUserWizard1.UserName, RolesName.NewEcs.ToString()))
        {
            Roles.AddUserToRole(CreateUserWizard1.UserName, RolesName.NewEcs.ToString());   
        }
        
        string xx = EmployeeProfile1.EmpEmail;
        if (!string.IsNullOrEmpty(xx))
        {
            CreateUserWizard1.Email = xx;
        }
    }
    protected void CreateUserWizard1_NextButtonClick(object sender, WizardNavigationEventArgs e)
    {

        //TextBox xx = CompanyProfileContactDetails1.FindControl("txt_LCompanyEmail") as TextBox;
        //if (!string.IsNullOrEmpty(xx.Text))
        //{
        //    CreateUserWizard1.Email = xx.Text;
        //}
        string xx = EmployeeProfile1.EmpEmail;
        if (!string.IsNullOrEmpty(xx))
        {
            //CreateUserWizard1.Email = xx;
            ((TextBox)CreateUserWizard1.CreateUserStep.
                ContentTemplateContainer.FindControl("EmailM")).Text = xx;
        }
    }
}
